package com.iris.live.services.data.repositories;

import com.iris.live.services.data.models.Lsh套餐信息Model;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * Created by sxy on 2016/7/11.
 */
public interface Lsh套餐信息Repository extends JpaRepository<Lsh套餐信息Model, Integer>, JpaSpecificationExecutor<Lsh套餐信息Model> {

    @Modifying
    @Query("update Lsh套餐信息Model u set u.启用状态 = ?2 where u.套餐编号 = ?1")
    int set启用状态By套餐编号(int id, String status);

    @Query("select a from Lsh套餐信息Model a where a.套餐编号=?1 and a.是否套餐=?2 ")
    List<Lsh套餐信息Model> findListById(Integer id, String status);

    @Query("delete from Lsh套餐信息Model where 套餐编号 = ?1")
    @Modifying
    int deleteById(Integer id);

}
